export const useCounterStore = defineStore('counter', () => {

    /**
     * 数值
     */
    const n = ref(1)
    /**
     * 数值乘2
     */
    const double = computed(() => {
        return n.value * 2
    })

    /**
     * 增加数值
     * @param amount 增加结果
     */
    function increment(amount = 1) {
        n.value = n.value + amount
    }

    /**
     * 随机数数值
     */
    function runRandom() {
        n.value = Math.random()
    }
    return {
        n,
        double,
        increment,
        runRandom
    }
})
